﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Protobuf_Gui.Domain
{
    [Serializable]
    [ContainType(typeof(PbFile),"File")]
    internal class PbProject
    {
        public string Name { get; set; }

        public string Path { get; set; }

        public List<PbFile> Files { get; set; }

        public PbProject(string name)
        {
            Name = name;
            Files = new List<PbFile>();
        }

        public void SaveProtos(string folder)
        {
            
        }

        public void SaveProject(string folder)
        {

        }

        public static PbProject LoadProject(string file)
        {
            return null;
        }

        public TreeNode ToTreeNode()
        {
            var node = new TreeNode(Name);
            foreach (var file in Files)
            {
                var fileNode = ProtocolElement.CreateNode(file);
                file.ToTreeNode(fileNode);
                node.Nodes.Add(fileNode);
            }
            return node;
        }
    }
}